Github Actions
Follow the steps below to set up your GitHub Actions CI builds to send test results and coverage files (optionally) to BuildPulse to help you identify and eliminate flaky tests.
If you'd like help at any step, please get in touch.
1. Create an API token.
In BuildPulse, open Organization Settings, then API Keys, and click Create API Key. The key starts with bp_ and is shown once. Store it as a repository or organization secret on GitHub named BUILDPULSE_API_TOKEN.
The BuildPulse GitHub App has to be installed on the repository. Without it, uploads are accepted but the results do not appear in BuildPulse.
2. Add the BuildPulse test reporter action after the step that runs your tests.
steps:
- name: Run tests
run: pytest --junitxml=reports/junit.xml
- name: Upload test results to BuildPulse
if: '!cancelled()'
uses: BuildPulseLLC/test-reporter-action@v3
with:
api-token: ${{ secrets.BUILDPULSE_API_TOKEN }}
path: reports/junit.xml
path is where your test framework writes its JUnit XML. The repository is detected from the GitHub Actions environment, so there is no account or repository ID to copy. if: '!cancelled()' uploads results from failing runs too, which is where flaky tests show up. The job needs a checkout of the repository, because the action reads the git tree SHA from it.
Optional inputs include coverage-files (space-separated paths to LCOV or Cobertura XML files) and tags (space-separated, see Tags). The full list is in the action's README.
buildpulse/buildpulse-action?Change the uses: line to BuildPulseLLC/test-reporter-action@v3. Your existing key, secret, account and repository inputs keep working, and you can move to api-token when it suits you.
3. Commit the changes to your GitHub Actions workflow file.
Push your branch to GitHub, and verify that you still have a passing build on github.com.
When everything is working correctly, you should see a successful step labeled "Upload test results to BuildPulse", and a summary of the results on the job page.
Within a few minutes, you'll see your first flaky test analysis in your dashboard. 😅